//
// Forward declarations of functions
//
var handleHomePage;
var handleChallengePage;
var handleAccountsPage;
var handleStatementsAndDocumentsPage;
var handleDownloadTransactionsPage;

//
// Set constants
//

const QUERYPARAMETER_ACCOUNT_IDENTITIFIER = 'AI';
const QUERYPARAMETER_ACCOUNT_IDENTITIFIER_ALT = 'AccountId';
const QUERYPARAMETER_OPTION_ID = 'OptionId';
const QUERYPARAMETER_OPTED_FOR_PAPERLESS = 'OptedForPaperless';
const QUERYPARAMETER_ELIGIBLE_FOR_PAPERLESS = 'EligibleForPaperless';
const QUERYPARAMETER_HASH = 'Hash';


const STATEMENTS_DOWNLOAD_PAGE_BASE_URL='https://stmts.chase.com/stmtslist';
const STATEMENT_PAGE_BASE_URL='https://stmts.chase.com/stmt/StatementContainer';
const TRANSACTIONS_PAGE_BASE_URL='https://banking.chase.com/AccountActivity/AccountDetails.aspx';
const TRANSACTIONS_DOWNLOAD_METHOD_BASE_URL='https://banking.chase.com/AccountActivity/SelectDownloadMethod.aspx';
const TRANSACTIONS_DOWNLOAD_BASE_URL='https://banking.chase.com/AccountActivity/AccountActivityForm.aspx';


const PAGES =
        [ 
            {
                moniker:"home page",
                href:new RegExp("^https://www\\.chase\\.com/", "i"),
                handler:handleHomePage
            },
            {
                moniker:"home page",
                href:new RegExp("^https://chaseonline\\.chase\\.com/Logon\\.aspx", "i"),
                handler:handleHomePage
            },
            {
                moniker:"challenge page",
                href:new RegExp("^https://unknown", "i"),
                handler:handleChallengePage
            },
            {
                moniker:"accounts page",
                href:new RegExp("^https://chaseonline\\.chase\\.com/MyAccounts\\.aspx", "i"),
                handler:handleAccountsPage
            },
            {
                moniker:"statements page",
                href:new RegExp("^https://stmts\\.chase\\.com/stmtslist\\?AI=\\d+", "i"),
                handler:handleStatementsAndDocumentsPage
            },
            {
                moniker:"download transactions page",
                href:new RegExp("https://banking\\.chase\\.com/AccountActivity/AccountActivityForm\\.aspx\\?AI=\\d+"),
                handler:handleDownloadTransactionsPage
            }
        ];
